#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive

${HIVE_HOME} -S -e "
-- 分区
--动态分区配置
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.max.dynamic.partitions.pernode=10000;
set hive.exec.max.dynamic.partitions=100000;
set hive.exec.max.created.files=150000;
--hive压缩
set hive.exec.compress.intermediate=true;
set hive.exec.compress.output=true;
--写入时压缩生效
set hive.exec.orc.compression.strategy=COMPRESSION;

-- 插入学生签到打卡【事实表】
insert overwrite table edu_dwd.dwd_FT_tbh_student_signin_record partition(dt)
select
    id,
    time_table_id,
    class_id,
    student_id,
    signin_time,
    signin_date,
    normal_class_flag,
    share_state,
    dt
from edu_ods.ods_tbh_student_signin_record;


-- 插入学生请假申请【事实表】
insert overwrite table edu_dwd.dwd_FT_student_leave_apply partition(dt)
select
    id,
    class_id,
    student_id,
    audit_state,
    audit_person,
    audit_time,
    audit_remark,
    leave_type,
    leave_reason,
    begin_time,
    begin_time_type,
    end_time,
    end_time_type,
    days,
    cancel_state,
    cancel_time,
    old_leave_id,
    leave_remark,
    valid_state,
    create_time,
    dt
from edu_ods.ods_student_leave_apply;
"
